using System;
using System.Collections.Generic;
using System.Text;
using Gremlin.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;

namespace Squadron
{
    public class Projectile : Mesh
    {
        protected uint damage;
        protected int life;
        protected bool dead;
        protected float speed;

        public Projectile(Microsoft.Xna.Framework.Game game, ContentManager content, String modelName,
            Quaternion rotation, int life, uint damage, float speed)
            : base(game, content, modelName)
        {
            _rotation = rotation;
            this.life = life;
            this.damage = damage;
            this.speed = speed;
            dead = false;

            _boundingSphere.Radius = 0.3f;
        }

        public override void Update(GameTime gameTime)
        {
            Position += Direction * speed;
            life -= gameTime.ElapsedGameTime.Milliseconds;

            if (life <= 0)
                dead = true;

            base.Update(gameTime);
        }

        public bool IsDead
        {
            get { return dead; }
            set { dead = value; }
        }

        public uint Damage
        {
            get { return damage; }
        }
    }
}
